# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=blackeye
_pkgname=blackeye-im
pkgver=v2.5.r8.gbdc11a2
pkgrel=1
epoch=1
pkgdesc='Ultimate phishing tool with ngrok and serveo.'
arch=('any')
groups=('blackarch' 'blackarch-social' 'blackarch-automation')
url='https://github.com/Git-Ankitraj/blackeye-im'
license=('GPL3')
depends=('curl' 'php' 'wget' 'ngrok' 'unzip')
makedepends=('git')
source=("git+https://github.com/Git-Ankitraj/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

package() {
  cd $_pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm LICENSE README.md setup.sh

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec bash $pkgname.sh "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

